﻿using System;
using gbL.NetBoard.Broadcast;

namespace gbL.NetBoard.Testing
{
    /// <summary>
    /// These extension methods assist unit testing of applications using netBoard by exposing the Broadcaster 
    /// methods from IBroadcasterTestSeams.
    /// </summary>
    public static class IFilteringBroadcasterExtensions
    {
        public static Delegate[] GetInvocationListAdded(this IFilteringBroadcaster broadcaster)
        {
            IBroadcasterTestSeams seams = broadcaster as IBroadcasterTestSeams;
            if (seams == null) return new Delegate[0];
            return seams.GetInvocationListAdded();
        }

        public static Delegate[] GetInvocationListRemoved(this IFilteringBroadcaster broadcaster)
        {
            IBroadcasterTestSeams seams = broadcaster as IBroadcasterTestSeams;
            if (seams == null) return new Delegate[0];
            return seams.GetInvocationListRemoved();
        }
    }
}
